package cn.tedu.eguser1.base.exception;

import cn.tedu.eguser1.base.response.JsonResult ;
import cn.tedu.eguser1.base.response.StatesCode ;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(MethodArgumentNotValidException.class)
    public JsonResult handleIllegalAccessException(MethodArgumentNotValidException e) {
        String message=e.getMessage();
        return new  JsonResult(StatesCode.MethodArgumentNotValidException,message);
    }
}
